package org.cmg.study.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * @author CMG
 * @version 1.0
 * @cLassName MainApp11
 * @description
 * @date 2021/9/1 13:59
 **/
public class MainApp11 {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml");
        PersonDao dao = (PersonDao) ctx.getBean("personDao");
        dao.createPersonTable();
        dao.savePerson(new Person("cmg", 12));
        dao.savePerson(new Person("stdvn", 23));
        List<Person> persons = dao.listPerson();
        for(Person person : persons){
            System.out.println(person);
        }
    }
}
